package com.dios.mirage.component;

import com.dios.mirage.navigation.Navigation;

import net.rim.device.api.system.Display;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.ui.decor.BackgroundFactory;

public class DescriptionFieldManager extends VerticalFieldManager {

	private LabelField titleLabel;
	private LabelField descLabel;

	public LabelField getTitleLabel() {
		return titleLabel;
	}

	public LabelField getDescLabel() {
		return descLabel;
	}

	public DescriptionFieldManager(long arg0) {
		super(arg0);
		init();
		setBackground(BackgroundFactory.createSolidBackground(Color.BLACK));
		add(titleLabel);
		add(descLabel);
	}

	public void init() {
		titleLabel = new LabelField() {
			public void paint(Graphics g) {
				g.setColor(Color.RED);
				super.paint(g);
			}
		};
		titleLabel.setFont(Navigation.loadCustomFonts(getClass().getResourceAsStream(Navigation.fontPath), Font.BOLD, 30));
		descLabel = new LabelField() {
			public void paint(Graphics g) {
				g.setColor(Color.WHITE);
				super.paint(g);
			}
		};
		descLabel.setFont(Navigation.loadCustomFonts(getClass().getResourceAsStream(Navigation.fontPath), Font.ITALIC, 30));
	}

	protected void sublayout(int maxWidth, int maxHeight) {
		super.sublayout(maxWidth, maxHeight);
		setExtent(Display.getWidth(), titleLabel.getHeight() + descLabel.getHeight());
	}
}
